package wait.notify.five.container.size;

import java.util.Random;
import java.util.concurrent.TimeUnit;

public class Producer2 implements Runnable {

	private MyContainer myContainer=null;
	
	
	public Producer2(MyContainer myContainer) {
		super();
		this.myContainer = myContainer;
	}

	
	
	public void run() {
		while(true){
//			if(myContainer.getContainer().size()<=5){
				Integer tempI=new Random().nextInt(10);
				myContainer.put(tempI);
				System.out.println(Thread.currentThread().getName()+"^_^Has Put"+tempI);
				try {
					TimeUnit.MICROSECONDS.sleep(100);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
//			}
		}
	}

}
